﻿using BLToolkit.Data;

using EMan.Common;
using EMan.Common.EnterpriseStructure;
using EMan.DAL.Firebird;
using EMan.Server.BL;

using EMan.Server.Interface.DAL;
using EMan.Server.WCF;

using TrueCode.Core.Validation;
using TrueCode.DependencyManager;
using TrueCode.DependencyManager.Extensions;

namespace EMan.Server.DependencyInjection.Scoping
{
  public static class GlobalScopeContainerProvider
  {
    public static Container GetContainer()
    {
      var container = ServerFactory.CreateContainer();
      container
        .Register< EManService >().Using.FactoryMethod( "Create" )
        .Register< EManImpl >().As< IEMan >()
        .Register< DbManager >().Using.FactoryMethod( bs => new DbManager() )
        .Register< Validator >().As< IValidator >().AsSingleton()

        // ------------ Data accessors --------------
        .Register< DepartmentDalc >().As< IDalc< Department > >()
        .Register< EmployeeDalc >().As< IEmployeeDalc >()
        .Register< JobDalc >().As< IDalc< Job > >()
        .Register< WorkTaskDalc >().As< IWorkTaskDalc >()
        // ------------------------------------------
        ;

      return container;
    }
  }
}